﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Sinacor.OMM.HealthMonitor.Entity.Msmq;
using Sinacor.OMM.HealthMonitor.Entity.Common;

namespace Sinacor.OMM.HealthMonitor.Entity.Router
{
    [Serializable()]
    public class MessageReceiver : IHealthDataReset
    {

        HealthEntityBase _healthEntityBase;

        public MessageReceiver()
        {
            _healthEntityBase = new HealthEntityBase();
        }

        public MessageReceiver(HealthEntityBase healthEntityBase)
        {
            _healthEntityBase = healthEntityBase;
        }

        //Número de Tentativas Reconexão com MSMQ (Fila receptor)
        private long _msmqConnectionsRetries;
        public long MsmqConnectionsRetries
        {
            get { return _msmqConnectionsRetries; }
            set 
            { 
                _msmqConnectionsRetries = value;
                _healthEntityBase.LastUpdate = DateTime.Now;
            }
        }

        //Mensagens Traduzidas por segundo
        private int _translatedMessagesForSecond;
        public int TranslatedMessagesForSecond
        {
            get { return _translatedMessagesForSecond; }
            set 
            { 
                _translatedMessagesForSecond = value;
                _healthEntityBase.LastUpdate = DateTime.Now;
            }
        }
        //Número total de Mensagens Recebidas
        private long _messagesReceivedQuantity;
        public long MessagesReceivedQuantity
        {
            get { return _messagesReceivedQuantity; }
            set 
            { 
                _messagesReceivedQuantity = value;
                _healthEntityBase.LastUpdate = DateTime.Now;
            }
        }

        //Numero Mensagens em Fila Interna #1
        private long _internalQueuedMessages_01_Quantity;
        public long InternalQueuedMessages_01_Quantity
        {
            get { return _internalQueuedMessages_01_Quantity; }
            set 
            { 
                _internalQueuedMessages_01_Quantity = value;
                _healthEntityBase.LastUpdate = DateTime.Now;
            }
        }

        //Limite Numero Mensagens em Fila Interna #1
        private long _limitInternalQueuedMessages_01_Quantity;
        public long LimitInternalQueuedMessages_01_Quantity
        {
            get { return _limitInternalQueuedMessages_01_Quantity; }
            set 
            { 
                _limitInternalQueuedMessages_01_Quantity = value;
                _healthEntityBase.LastUpdate = DateTime.Now;
            }
        }

        #region IHealthDataReset Members

        public void Reset()
        {
            MsmqConnectionsRetries = 0;
            TranslatedMessagesForSecond = 0;
            MessagesReceivedQuantity = 0;
            InternalQueuedMessages_01_Quantity = 0;
        }

        #endregion
    }
}
